//go:build !linux

package main

import (
	"fmt"
	"golang.org/x/sys/windows"
	"os"
	"os/exec"
	"path/filepath"
	"syscall"
)

func main() {
	cmd := os.Args[0]
	dir := filepath.Dir(cmd)
	cmdPath := filepath.Join(dir, "app")
	fmt.Printf("Command      : %s\n", cmd)
	fmt.Printf("Dir          : %s\n", dir)
	fmt.Printf("CmdPath      : %s\n", cmdPath)
	args := os.Args[1:]
	args = append([]string{"app"}, args...)
	c := exec.Command(cmdPath, args...)
	c.SysProcAttr = &syscall.SysProcAttr{
		HideWindow:    true,
		CreationFlags: windows.CREATE_NEW_PROCESS_GROUP,
	}
	fmt.Printf("Starting process %v\n", c)
	_ = c.Start()

}
